﻿#pragma once

#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>

namespace asycipc {

class TelemetryCenter {
 public:
  void IncrementCounter(const std::string& name, uint64_t delta = 1);
  uint64_t GetCounter(const std::string& name) const;

  void SetGauge(const std::string& name, double value);
  double GetGauge(const std::string& name) const;

  void ObserveHistogram(const std::string& name, double value);
  std::vector<double> GetHistogram(const std::string& name) const;

 private:
  mutable std::mutex mutex_;
  std::unordered_map<std::string, uint64_t> counters_;
  std::unordered_map<std::string, double> gauges_;
  std::unordered_map<std::string, std::vector<double>> histograms_;
};

}  // namespace asycipc
